import 'package:sow_app_core/sow_app_core.dart';

class UserInfoModel {
  final int userId;
  final String userName;
  final String nickName;
  final String? accountBalance;

  UserInfoModel.fromJson(Map<String, dynamic> json)
      : userId = int.parse(json['username']),
        userName = json['username'],
        nickName = json['nickName'],
        accountBalance = json['accountBalance'];

  Map<String, dynamic> toJson() => {
        'userId': userId,
        'userName': userName,
        'nickName': nickName,
        'accountBalance': accountBalance
      };

  User toEntity() => User(userId, userName, nickName, accountBalance);
}
